package com.lxl.bt.activity;

import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.annotation.Nullable;
import androidx.appcompat.widget.Toolbar;

import com.lxl.bt.R;
import com.lxl.bt.activity.BaseActivity;
import com.lxl.bt.util.ACache;
import com.yanzhenjie.sofia.Sofia;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Create by lvxinlong
 * on  选择国家和地区
 * on  2020年12月5日16:59:33
 **/
public class SelectAreaActivity extends BaseActivity {


    @BindView(R.id.ivBack)
    ImageView ivBack;
    @BindView(R.id.rlBack)
    RelativeLayout rlBack;
    @BindView(R.id.txt_toolbar_title)
    TextView txtToolbarTitle;
    @BindView(R.id.ivRight)
    ImageView ivRight;
    @BindView(R.id.tvRight)
    TextView tvRight;
    @BindView(R.id.rlRight)
    RelativeLayout rlRight;
    @BindView(R.id.toolbar)
    Toolbar toolbar;
    @BindView(R.id.ll1)
    LinearLayout ll1;
    @BindView(R.id.ll2)
    LinearLayout ll2;
    @BindView(R.id.ll3)
    LinearLayout ll3;
    @BindView(R.id.ll4)
    LinearLayout ll4;
    private Context context;
    ACache aCache;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_selectarea);
        ButterKnife.bind(this);
        //状态栏全透明全屏显示页面，布局能够延伸到状态栏和导航栏下方
        Sofia.with(this)
                .invasionStatusBar()
//                .statusBarLightFont()
                .statusBarDarkFont()
                .statusBarBackgroundAlpha(0)
                .invasionNavigationBar()
                .navigationBarBackgroundAlpha(0);

        context = this;
        rlBack.setVisibility(View.VISIBLE);
        txtToolbarTitle.setText("修改登录密码");
        toolbar.setBackgroundResource(R.color.color_F2F2F2);
        txtToolbarTitle.setTextColor(getResources().getColor(R.color.c63));
        ivBack.setImageResource(R.mipmap.black_back);
        aCache = ACache.get(this);
//        tvCardno.setText(Prefs.getStringValue(Constant.CARDNO));
    }


//    private void commit() {
//        if (TextUtils.isEmpty(etOldPass.getText().toString())) {
//            ToastUtil.showToast(this, "请输入旧密码");
//            return;
//        }
//        if (TextUtils.isEmpty(etNewPass.getText().toString())) {
//            ToastUtil.showToast(this, "请输入新密码");
//            return;
//        }
//        if (TextUtils.isEmpty(etNewPassAgain.getText().toString())) {
//            ToastUtil.showToast(this, "请确认新密码");
//            return;
//        }
//        if (!etNewPass.getText().toString().equals(etNewPassAgain.getText().toString())) {
//            ToastUtil.showToast(this, "请确认密码是否一致");
//            return;
//        }
//
//        JsonObject jsonObject = new JsonObject();
//        //"cardNumber": "0440000000166563",
//        //"password ": "fsefs",
//        //"newPassword1": "adsdf",
//        //"newPassword2": "adsdf"
//        jsonObject.addProperty("cardNumber", tvCardno.getText().toString());
//        jsonObject.addProperty("virtualCardNumber", Prefs.getStringValue(Constant.VirtualCardNumber));
//        jsonObject.addProperty("password", etOldPass.getText().toString());
//        jsonObject.addProperty("newPassword1", etNewPass.getText().toString());
//        jsonObject.addProperty("newPassword2", etNewPassAgain.getText().toString());
//        RetrofitUtil.getInstance().create(NetApi.class, 0)
//                .editPassword(jsonObject).enqueue(new NetCallback<Result<OnlyCode>>() {
//            @Override
//            public void onSuccess(Result<OnlyCode> result) {
//                Log.w("lxl", ">>>>" + result.isSuccess());
//                if (result.isSuccess()) {
//                    ToastUtil.showToast(LoginActivity.this, "修改成功");
//                    finish();
//                } else {
//                    ToastUtil.showToast(LoginActivity.this, result.getMsg());
//                }
//
//            }
//
//            @Override
//            public void onError(String errorStr) {
//                super.onError(errorStr);
//                Log.w("lxl", ">>>>" + errorStr);
//                ToastUtil.showToast(LoginActivity.this, errorStr);
//            }
//
//        });
//    }




    @OnClick({R.id.rlBack, R.id.ll1, R.id.ll2, R.id.ll3, R.id.ll4})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.rlBack:
                finish();
                break;
            case R.id.ll1:
                finish();
                break;
            case R.id.ll2:
                finish();
                break;
            case R.id.ll3:
                finish();
                break;
            case R.id.ll4:
                finish();
                break;
        }
    }
}
